interface Math{
    //最大值
    max(arr:number[]):number
    //最小值
    min(arr:number[]):number
    //绝对值
    abs(num:number):number
    //求和
    sum(arr:number[]):number
    //正弦
    sin(num:number):number
    //余弦
    cos(num:number):number
    //反正弦
    arcsin(num:number):number
    //反余弦
    arccos(num:number):number
    //正切
    tan(num:number):number
    //反正切
    arctan(num:number):number
    //余切
    cot(num:number):number
    //反余切
    arccot(num:number):number
    
}
export const math:Math={
  max(arr:number[]):number{
   let max:number=arr[0]
   for(let i=1;i<arr.length;i++){
    max=max>arr[i]?max:arr[i]
   }
   return max
  },
  min(arr:number[]):number{
    let min:number=arr[0]
    for(let i=1;i<arr.length;i++){
      min=min<arr[i]?min:arr[i]
    }
    return min
  },
  abs(num:number):number{
    return num>0?num:-num
  },
  sum(arr:number[]):number{
    let sum:number=0
    arr.forEach(item=>{
      sum+=item
    })
    return sum
  },
  sin(num:number):number{
    return Math.sin(num)
  },
  cos(num:number):number{
    return math.cos(num)
  },
  arcsin(num:number):number{
    return Math.asin(num)
  },
  arccos(num:number):number{
    return Math.acos(num)
  },
  tan(num:number):number{
    return Math.tan(num)
  },
  arctan(num:number):number{
    return Math.atan(num)
  },
  cot(num:number):number{
    return 1/Math.tan(num)
  },
  arccot(num:number):number{
    return 1/Math.atan(num)
  }
}